export default async function() {
  let url = location.href;
  let params = getQueryParams(url);
  if (params && params.sub) {
    uni.setStorageSync('sub', params.sub);
  }
  console.log(uni.getStorageSync('sub'))
}
function getQueryParams(url) {
    const paramArr = url.slice(url.indexOf("?") + 1).split("&");
    const params = {};
    paramArr.map((param) => {
        const [key, val] = param.split("=");
        params[key] = decodeURIComponent(val);
    });
    return params;
}